<extend name="./default/Base/userbase"/>

<block name="usermessage">
<article class="panel panel-default archive">
					<div class="panel-body">
						<h3 class="page-header">编辑原稿 <small>EDIT</small></h3>
						<form action="{:U('Ucenter/artedit')}" target="formAjax" editor="tinyMCE" method="post" noenter>
						<input type="hidden" name="id" value="{$info.id}" />
							<div class="form-group">
								<input type="text" class="form-control" name="title" placeholder="在此输入标题" value="{$info.title}">
							</div>						
				
							<div class="form-group">
							<div class="markeditor">
								
								<textarea name="description" id="content-editor"  rows="10">{$info.description}</textarea>
                             </div>  
 <if condition="($roleauth['yesfile'] eq 1) OR $isadmin">
                            <div id="content-pic"></div>
                            </if>
							</div>
							<div class="form-group">
						<p class="help-block">选择文章分类</p>
						<select name="cid" class="form-control">
						<volist name="clist" id="vo">
						
							<if condition="$isadmin">
						
						
						<option <if condition="$vo['id'] eq $info['cid']">selected</if> value="{$vo.id}">{$vo.name}</option>
						
						
						
						
						<else />
						
						<if condition="$vo['enable'] eq 1">
						<option <if condition="$vo['id'] eq $info['cid']">selected</if> value="{$vo.id}">{$vo.name}</option>
						</if>
						
						
						
						
						</if>
						
						
						
						
						
						</volist>
						</select>							</div>
								<div class="form-group">
								  <p class="help-block">设置文章标签,回车键可以添加一个标签,最多五个标签,支持逗号和回车断开标签</p>
						 
						<div class="tags-control tagsinput"  data-inputval="{$info.tag}" data-max="5"  data-parametername="tag[]">
                         <input type="text" size="20" class="tag-input form-control" value="" />
                         </div>
                       
                         </div>

							<div class="form-group text-right">
							
							<if condition="1 neq $info['status']">
							
							
								<select name="status">
									<option <if condition="5 eq $info['status']">selected</if> value="5">草稿</option>
									
									
									<if condition="($roleauth['yesshen'] eq 2) OR $isadmin">
									<option  value="1">直接发布</option>
									<else />
									<option <if condition="2 eq $info['status']">selected</if> value="2">等待复审</option>	
									</if>
									
									
									
															
									</select>
							</if>
							
								<button type="submit" class="btn btn-success">确认操作</button>
							</div>	
						</form>
					</div>
			 </article>
</block>			 
			 
			 
			 
			 
			 
<block name="script">

<script src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<link rel="stylesheet" type="text/css" href="__STATIC__/uploadify/uploadify.css" media="all">
<script>



$(function(){

	
	setTimeout(function(){
		$("#content-pic").uploadify({
			'removeTimeout' : 0.5,
			"fileObjName"     : "Picture",
			'multi'    : true,
			'swf' 			: _STATIC_+'/uploadify/uploadify.swf',
			'uploader' 		: "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
			'buttonText' 	: '<i class="icon-picture"></i>上传图片',
			'width' 		: '97',
			'height' 		: '34',
			'fileTypeExts'	: '*.jpg; *.png; *.gif;',
			'onUploadSuccess' : function(file,data){
				var data= $.parseJSON(data);
				if(data.status){
					var src = data.url || data.path
					tinyMCE.editors[0].insertContent('<img src="' + src + '" width="120" height="120" />');
					//$("#content-editor").append('<img src=".' + src + '" width="120" height="120" />');
				} else {
				  layer.statusinfo(data.info,'error');	
				}
			}
		});
        




		},3);




	
});
</script>

<script src="__JS__/tinymce/tinymce.min.js"></script>
<link href="__JS__/tinymce/editor.css" rel="stylesheet">
<script>



$(function(){

	tinymce.init({
		selector: "textarea#content-editor",
	    language : 'zh_CN',
	    plugins : ' autosave codelight link image code autoresize  textcolor',
	    menubar : false,
	    toolbar: "bold italic  underline | alignleft aligncenter alignright alignjustify | fontsizeselect | link unlink image | forecolor backcolor code codelight ",
	    statusbar : false,
	    convert_urls : false
	 });


	

});




</script>

</block>